$("document").ready(function(){
    $(".nav li:first-child").find("a").css("text-align","left");
    $(".nav li:last-child").find("a").css("text-align","right");
    $(".nav > li").hover(function(){
        //$(this).addClass("on");
        $(this).children("div").stop(true,true).slideDown("fast");
    },function(){
        // $(this).removeClass("on");
        $(this).children("div").stop(true,true).slideUp("fast");
    })
    $("#navChild a:last-child ").css("border-bottom","none")

    // dingwei();

    var pgname = document.location.href;
    pgname=pgname.replace(/\?.*$/,'')
    pgname=pgname.replace(/^.*\//,'')
    if(pgname=="index.php"||pgname=="index.php#"||pgname==null||pgname==""){
        $(".banner").css("height","375px");
        $(".bann").css("height","375px");
        $("#focus").css("height","375px");
        $("#focus ul").css("height","375px");
        $("#focus ul li").css("height","375px");
    }else{
        $("#focus .btn").css("bottom","14px");
    }
    $(".proListPic ul li:nth-child(4n)").css("margin-right","0px");
    $(".casePicUl li:last-child").css("margin-right","0px");



    $(".contactnr dl:nth-child(1) dt").css("background","url(images/mobile.png) 14px 6px no-repeat");
    $(".contactnr dl:nth-child(2) dt").css("background","url(images/tel.png) 10px 4px no-repeat");
    $(".contactnr dl:nth-child(3) dt").css("background","url(images/mail.png) 10px 8px no-repeat");
    $(".contactnr dl:nth-child(4) dt").css("background","url(images/address.png) 12px 4px no-repeat");


    $(".footContactnr dl:nth-child(2) dt").css("background","url(images/mobile.png) 14px 6px no-repeat");
    $(".footContactnr dl:nth-child(3) dt").css("background","url(images/tel.png) 10px 4px no-repeat");
    $(".footContactnr dl:nth-child(4) dt").css("background","url(images/mail.png) 10px 8px no-repeat");
    $(".footContactnr dl:nth-child(5) dt").css("background","url(images/address.png) 12px 4px no-repeat");


    $(".shareDiv").hover(function(){
        $(".shareList").css("display","block");
    },function(){
        $(".shareList").css("display","none");
    })

    $(".share .qq").hover(function(){
        $(this).css("background","url(images/qq2.png) left top no-repeat");
    },function(){
        $(this).css("background","url(images/qq.png) left top no-repeat");
    });
    $(".share .qq2").hover(function(){
        $(this).css("background","url(images/share2.png) left top no-repeat");
    },function(){
        $(this).css("background","url(images/share.png) left top no-repeat");
    });
    $(".site").hover(function(){
        $(this).css("background","url(images/site2.png) left top no-repeat");
    },function(){
        $(this).css("background","url(images/site.png) left top no-repeat");
    });


    $('.backTop').click(function(){
        $('body,html').animate({scrollTop:0},500)
    });
    $('.codepic').hover(function(){$('.code').fadeIn()},function(){$('.code').fadeOut()});
    $('.backup').click(function(){
        $('body,html').animate({scrollTop:0},500)
    });
    $(".backup").hide();
    $(function() {
        $(window).scroll(function(){
            if ($(window).scrollTop()>500){
                $(".backup").fadeIn(1000);
            }else{
                $(".backup").fadeOut(1000);
            }
        });
    });
    /* end index  jq  */

    $(".mainConList .pic1:nth-child(4n)").css("margin-right","0px");


    $(".pic2:last-child a").css("border-bottom","none");
    $(".mainConList ul li:last-child").css("border-bottom","none");


    $(".pglist ul li").not(".on").hover(function(){ $(this).addClass("on");},function(){$(this).removeClass("on");})

});



$("document").ready(function(){
    //case
    var page=1;
    var i=1;
    var box=$('.advPic ul');
    var n=$('.advPic li').length;
    var h=$('.advPic li').width();
    var pagetotal=Math.ceil(n/i);
    $('.picleft').bind('click',upwardsfn);
    $('.picright').bind('click',downfn);
    function upwardsfn(){
        if(page>1){
            box.animate({ marginLeft : '+='+h }, "slow");
            page--;
            $(".picright").find("img").attr('src','images/advrightb.png');
            if(page<=1){
                $('.picleft').find("img").attr('src','images/advleftw.png');
            }else{
                $('.picleft').find("img").attr('display','images/advleftb.png');
            }
        }
    }
    function downfn(){
        if(pagetotal>page){
            box.animate({ marginLeft : '-='+h }, "slow");
            page++;
            $(".picleft").find("img").attr('src','images/advleftb.png');
            if(page>=pagetotal){
                $('.picright').find("img").attr('src','images/advrightw.png');
            }else{
                $('.picright').find("img").attr('src','images/advrightb.png');
            }
        }
    }

});


//导航定位
function dingwei(){
    var nav = document.getElementById("nav");
    var links = nav.getElementsByTagName("li");
    var lilen =$("#nav").find("li");

    var st2=new Array();
    var str1=new Array();
    var urrenturl = document.location.href;
    urrenturl = urrenturl.replace("http://","");
    urrenturlArr = urrenturl.split("/");
    name = urrenturlArr[urrenturlArr.length-1];
    st2 = name.split("_");
    var last = 0;
    for (var i=0;i<links.length;i++)
    {
        linkurl =  lilen[i].getAttribute("rel");
        str1 = linkurl.split("/");
        var length2 = str1.length-1;
        str11 = str1[length2].split(".");
        if(st2[0].indexOf(str11[0])!=-1)
        {
            last = i;
        }
    }
    links[last].className = "menu";
}
function scrolling(a,b,c){
    var speedp=30;
    var tabp=document.getElementById(a);
    var tab1p=document.getElementById(b);
    var tab2p=document.getElementById(c);
    tab2p.innerHTML=tab1p.innerHTML;
    function Marqueep(){
        if(tab2p.offsetWidth-tabp.scrollLeft<=0)
            tabp.scrollLeft-=tab1p.offsetWidth
        else{
            tabp.scrollLeft++;
        }
    }
    var MyMarp=setInterval(Marqueep,speedp);
    tabp.onmouseover=function() {clearInterval(MyMarp)};
    tabp.onmouseout=function() {MyMarp=setInterval(Marqueep,speedp)};
}

function upscrolling(){
    var speed=40;
    sdemo2.innerHTML = sdemo1.innerHTML;
    function Marquee(){
        if(sdemo2.offsetHeight - sdemo.scrollTop <= 0) {
            sdemo.scrollTop -= sdemo1.offsetHeight;
        } else{
            sdemo.scrollTop++;
        }
    }
    var MyMar = setInterval(Marquee,speed);
    sdemo.onmouseover = function(){ clearInterval(MyMar); }
    sdemo.onmouseout = function(){ MyMar=setInterval(Marquee,speed) }
}

